package com.jsu.clubmanagementsystem.model.vo.activity;
import com.jsu.clubmanagementsystem.model.entity.Activity;
import com.jsu.clubmanagementsystem.model.enums.ActivityStatusEnum;
import com.jsu.clubmanagementsystem.model.vo.club.ClubVO;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

@Data
public class ActivityVO  implements Serializable {
    /**
     * 活动id
     */
    private Long id;

    /**
     * 所属社团
     */
    private ClubVO clubVO;

    /**
     * 活动名
     */
    private String activityName;

    /**
     * 活动文章标题
     */
    private String activityTitle;

    /**
     * 活动文章内容
     */
    private String activityContent;

    /**
     * 活动开始时间
     */
    private Date startTime;

    /**
     * 活动结束时间
     */
    private Date endTime;

    /**
     * 活动状态: 0-待审核, 1-确定举办, 2-进行中, 3-已结束, 4-已取消
     */
    private String status;

    private static final long serialVersionUID = 1L;

    /**
     * 获取封装对象
     * @param activity
     * @return
     */
    public static ActivityVO objToVo(Activity activity){
        ActivityVO activityVO = new ActivityVO();
        BeanUtils.copyProperties(activity, activityVO);
        activityVO.setStatus(ActivityStatusEnum.getStatusEnumByCode((int)activity.getStatus()).getInfo());
        return activityVO;
    }
}